﻿
// Test1Dlg.cpp: 实现文件
//

#include "pch.h"
#include "framework.h"
#include "Test1.h"
#include "Test1Dlg.h"
#include "afxdialogex.h"
#include "set_m.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// 用于应用程序“关于”菜单项的 CAboutDlg 对话框

class CAboutDlg : public CDialogEx
{
public:
	CAboutDlg();

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_ABOUTBOX };
#endif

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

// 实现
protected:
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()


// CTest1Dlg 对话框



CTest1Dlg::CTest1Dlg(CWnd* pParent /*=nullptr*/)
	: CDialog(IDD_TEST1_DIALOG, pParent)
	, m_shengao(0)
	, m_tizhong(500)
	, m_feihuoliang(00)
	, m_zuoliqianqu(-30)
	, m_lidingtiaoyuan(0)
	, m_50m(0)
	, m_1000m1(0)
	, m_1000m2(0)
	, m_0(0)
	, m_output(_T(""))
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CTest1Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO1, m_setCombobox);
	DDX_Text(pDX, IDC_EDIT1, m_shengao);
	DDV_MinMaxInt(pDX, m_shengao, 0, INT_MAX);
	DDX_Text(pDX, IDC_EDIT2, m_tizhong);
	DDV_MinMaxDouble(pDX, m_tizhong, 0, DBL_MAX);
	DDX_Text(pDX, IDC_EDIT3, m_feihuoliang);
	DDV_MinMaxDouble(pDX, m_feihuoliang, 0, DBL_MAX);
	DDX_Text(pDX, IDC_EDIT4, m_zuoliqianqu);
	DDX_Text(pDX, IDC_EDIT5, m_lidingtiaoyuan);
	DDV_MinMaxDouble(pDX, m_lidingtiaoyuan, 0, DBL_MAX);
	DDX_Text(pDX, IDC_EDIT6, m_50m);
	DDV_MinMaxDouble(pDX, m_50m, 0, DBL_MAX);
	DDX_Text(pDX, IDC_EDIT7, m_1000m1);
	DDV_MinMaxDouble(pDX, m_1000m1, 0, DBL_MAX);
	DDX_Text(pDX, IDC_EDIT8, m_1000m2);
	DDV_MinMaxInt(pDX, m_1000m2, 00, INT_MAX);
	DDX_Text(pDX, IDC_EDIT9, m_0);
	DDV_MinMaxInt(pDX, m_0, 0, INT_MAX);
	DDX_Text(pDX, IDC_EDIT10, m_output);
}

BEGIN_MESSAGE_MAP(CTest1Dlg, CDialog)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BUTTON1, &CTest1Dlg::OnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &CTest1Dlg::OnBnClickedButton2)
	ON_EN_KILLFOCUS(IDC_EDIT1, &CTest1Dlg::OnKillfocusEdit1)
	ON_EN_KILLFOCUS(IDC_EDIT2, &CTest1Dlg::OnKillfocusEdit2)
	ON_EN_KILLFOCUS(IDC_EDIT3, &CTest1Dlg::OnKillfocusEdit3)
	ON_EN_KILLFOCUS(IDC_EDIT4, &CTest1Dlg::OnKillfocusEdit4)
	ON_EN_KILLFOCUS(IDC_EDIT5, &CTest1Dlg::OnKillfocusEdit5)
	ON_EN_KILLFOCUS(IDC_EDIT6, &CTest1Dlg::OnKillfocusEdit6)
	ON_EN_KILLFOCUS(IDC_EDIT7, &CTest1Dlg::OnKillfocusEdit7)
	ON_EN_KILLFOCUS(IDC_EDIT8, &CTest1Dlg::OnKillfocusEdit8)
	ON_EN_KILLFOCUS(IDC_EDIT9, &CTest1Dlg::OnKillfocusEdit9)
	ON_BN_CLICKED(IDC_BUTTON3, &CTest1Dlg::OnBnClickedButton3)
	ON_COMMAND(IDC_RADIO1, &CTest1Dlg::OnRadio1)
	ON_COMMAND(IDC_RADIO2, &CTest1Dlg::OnRadio2)
END_MESSAGE_MAP()


// CTest1Dlg 消息处理程序

BOOL CTest1Dlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// 将“关于...”菜单项添加到系统菜单中。

	// IDM_ABOUTBOX 必须在系统命令范围内。
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != nullptr)
	{
		BOOL bNameValid;
		CString strAboutMenu;
		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
		ASSERT(bNameValid);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// 设置此对话框的图标。  当应用程序主窗口不是对话框时，框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO: 在此添加额外的初始化代码
 //**********************************************************************************
 //	m_setCombobox.SetCurSel(4);
    CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT1);//获取身高的编辑框ID
	pEdit1->SetWindowText(_T("如:170")); //设置默认显示的内容 

	CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT2);//获取体重的编辑框ID
	pEdit2->SetWindowText(_T("如:50")); //设置默认显示的内容 

	CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT3);//获取肺活量的编辑框ID
	pEdit3->SetWindowText(_T("如:3000")); //设置默认显示的内容 

	CEdit* pEdit4 = (CEdit*)GetDlgItem(IDC_EDIT4);//获取坐立前屈的编辑框ID
	pEdit4->SetWindowText(_T("如:15")); //设置默认显示的内容 

	CEdit* pEdit5 = (CEdit*)GetDlgItem(IDC_EDIT5);//获取立定跳远的编辑框ID
	pEdit5->SetWindowText(_T("如:2.2")); //设置默认显示的内容 

	CEdit* pEdit6 = (CEdit*)GetDlgItem(IDC_EDIT6);//获取50米跑的编辑框ID
	pEdit6->SetWindowText(_T("如:7.5")); //设置默认显示的内容

	CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
	pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

	CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
	pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 

	CEdit* pEdit9 = (CEdit*)GetDlgItem(IDC_EDIT9);//获取引体向上的编辑框ID
	pEdit9->SetWindowText(_T("如:15")); //设置默认显示的内容 

	CEdit* pEdit11 = (CEdit*)GetDlgItem(1018);
	pEdit11->SetWindowText(_T("1000米跑")); 

	CEdit* pEdit12 = (CEdit*)GetDlgItem(1019);
	pEdit12->SetWindowText(_T("引体向上"));
//***********************************************************************************/
	return TRUE;  // 除非将焦点设置到控件，否则返回 TRUE
}

void CTest1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// 如果向对话框添加最小化按钮，则需要下面的代码
//  来绘制该图标。  对于使用文档/视图模型的 MFC 应用程序，
//  这将由框架自动完成。

void CTest1Dlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // 用于绘制的设备上下文

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// 使图标在工作区矩形中居中
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// 绘制图标
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CTest1Dlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}

void CTest1Dlg::OnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	if (sex == 0)
	{
		MessageBox("请输入性别", "温馨提示", MB_ICONINFORMATION);
		return;
	}
	else if (sex == 1)
	{
		GetDlgItemText(IDC_COMBO1, strText);
		if (strText == "①大一" || strText == "②大二")
		{
			//肺活量单项成绩得分
			if (m_feihuoliang < 2300)
				score2 = 0;
			else if (2300 <= m_feihuoliang && m_feihuoliang < 3100)
				score2 = 10 + int((m_feihuoliang - 2300) / 16);
			else if (3100 <= m_feihuoliang && m_feihuoliang < 4300)
				score2 = 60 + int((m_feihuoliang - 3100) / 60);
			else if (4300 <= m_feihuoliang && m_feihuoliang < 4800)
				score2 = 80 + int((m_feihuoliang - 4300) / 50);
			else if (4800 <= m_feihuoliang && m_feihuoliang < 5040)
				score2 = 90 + int((m_feihuoliang - 4800) / 24);
			else
				score2 = 100;

			//坐立前屈单项成绩得分
			if (m_zuoliqianqu < -1.3)
				score3 = 0;
			else if (-1.3 <= m_zuoliqianqu && m_zuoliqianqu < 3.7)
				score3 = 10 + int((m_zuoliqianqu - (-1.3)) / 0.1);
			else if (3.7 <= m_zuoliqianqu && m_zuoliqianqu < 17.7)
				score3 = 60 + int((m_zuoliqianqu - (3.7)) / 0.7);
			else if (17.7 <= m_zuoliqianqu && m_zuoliqianqu < 21.3)
				score3 = 80 + int((m_zuoliqianqu - 17.7) / 0.36);
			else if (21.3 <= m_zuoliqianqu && m_zuoliqianqu < 24.9)
				score3 = 90 + int((m_zuoliqianqu - 21.3) / 0.36);
			else
				score3 = 100;

			//立定跳远单项成绩得分
			if (m_lidingtiaoyuan < 1.83)
				score4 = 0;
			else if (1.83 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.08)
				score4 = 10 + int((m_lidingtiaoyuan - 1.83) / 0.005);
			else if (2.08 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.48)
				score4 = 60 + int((m_lidingtiaoyuan - 2.08) / 0.02);
			else if (2.48 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.63)
				score4 = 80 + int((m_lidingtiaoyuan - 2.48) / 0.015);
			else if (2.63 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.73)
				score4 = 90 + int((m_lidingtiaoyuan - 2.63) / 0.01);
			else
				score4 = 100;

			//50米跑单项成绩得分
			if (m_50m > 10.1)
				score5 = 0;
			else if (9.1 < m_50m && m_50m <= 10.1)
				score5 = 10 + int((m_50m - 10.1) / -0.02);
			else if (7.1 < m_50m && m_50m <= 9.1)
				score5 = 60 + int((m_50m - 9.1) / -0.1);
			else if (6.9 < m_50m && m_50m <= 7.1)
				score5 = 80 + int((m_50m - 7.1) / -0.02);
			else if (6.7 < m_50m && m_50m <= 6.9)
				score5 = 90 + int((m_50m - 6.9) / -0.02);
			else
				score5 = 100;

			//1000米跑单项成绩得分
			if ((m_1000m1 * 60 + m_1000m2) > (6 * 60 + 12))
				score6 = 0;
			else if ((4 * 60 + 32) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (6 * 60 + 12))
				score6 = 10 + int(((m_1000m1 * 60 + m_1000m2) - (6 * 60 + 12)) / -2);
			else if ((3 * 60 + 42) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (4 * 60 + 32))
				score6 = 60 + int(((m_1000m1 * 60 + m_1000m2) - (4 * 60 + 32)) / -2.5);
			else if ((3 * 60 + 34) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 42))
				score6 = 80 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 42)) / -1.6);
			else if ((3 * 60 + 27) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 34))
				score6 = 85 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 34)) / -1.4);
			else if ((3 * 60 + 17) <= (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 27))
				score6 = 90 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 27)) / -1);
			//男生1000米跑加分指标
			else if ((2 * 60 + 54) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < (3 * 60 + 17))
				score6 = 100 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) / -4);
			else if (90 < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < (2 * 60 + 54))
				if (-26 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) <= -23)
					score6 = 100 + 6;
				else if (-29 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) <= -26)
					score6 = 100 + 7;
				else if (-32 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) <= -29)
					score6 = 100 + 8;
				else if (-35 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) <= -32)
					score6 = 100 + 9;
				else// if ( ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 17)) <= -35)
					score6 = 100 + 10;
			//		else
			//			MessageBox("您已超越光速,请检查填写的数据是否正确", "温馨提示", MB_ICONINFORMATION);

					//引体向上单项成绩得分
			if (m_0 < 5)
				score7 = 0;
			else if (5 <= m_0 && m_0 < 10)
				score7 = 10 + (m_0 - 5) * 10;
			else if (10 <= m_0 && m_0 < 15)
				score7 = 60 + (m_0 - 10) * 4;
			else if (15 <= m_0 && m_0 < 19)
				score7 = 80 + (m_0 - 15) * 5;
			//男生引体向上分指标
			else if (19 <= m_0 && m_0 < 200)
				score7 = 100 + (m_0 - 19);
			//		else
			//			MessageBox("流批啊兄弟，这么强壮的身体军队里出来的吧\n         (一般人拉不了这么多引体向上)", "温馨提示", MB_ICONINFORMATION);
		}
		else if (strText == "③大三" || strText == "④大四")
		{
			//肺活量单项成绩得分
			if (m_feihuoliang < 2350)
				score2 = 0;
			else if (2350 <= m_feihuoliang && m_feihuoliang < 3200)
				score2 = 10 + int((m_feihuoliang - 2350) / 17);
			else if (3200 <= m_feihuoliang && m_feihuoliang < 4400)
				score2 = 60 + int((m_feihuoliang - 3200) / 60);
			else if (4400 <= m_feihuoliang && m_feihuoliang < 4900)
				score2 = 80 + int((m_feihuoliang - 4400) / 50);
			else if (4900 <= m_feihuoliang && m_feihuoliang < 5140)
				score2 = 90 + int((m_feihuoliang - 4900) / 24);
			else
				score2 = 100;

			//坐立前屈单项成绩得分
			if (m_zuoliqianqu < -0.8)
				score3 = 0;
			else if (-0.8 <= m_zuoliqianqu && m_zuoliqianqu < 4.2)
				score3 = 10 + int((m_zuoliqianqu - (-0.8)) / 0.1);
			else if (4.2 <= m_zuoliqianqu && m_zuoliqianqu < 18.2)
				score3 = 60 + int((m_zuoliqianqu - (4.2)) / 0.7);
			else if (18.2 <= m_zuoliqianqu && m_zuoliqianqu < 19.9)
				score3 = 80 + int((m_zuoliqianqu - 18.2) / 0.34);
			else if (19.9 <= m_zuoliqianqu && m_zuoliqianqu < 21.5)
				score3 = 85 + int((m_zuoliqianqu - 19.9) / 0.32);
			else if (21.5 <= m_zuoliqianqu && m_zuoliqianqu < 25.1)
				score3 = 90 + int((m_zuoliqianqu - 21.5) / 0.36);
			else
				score3 = 100;

			//立定跳远单项成绩得分
			if (m_lidingtiaoyuan < 1.85)
				score4 = 0;
			else if (1.85 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.10)
				score4 = 10 + int((m_lidingtiaoyuan - 1.85) / 0.005);
			else if (2.10 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.50)
				score4 = 60 + int((m_lidingtiaoyuan - 2.10) / 0.02);
			else if (2.50 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.58)
				score4 = 80 + int((m_lidingtiaoyuan - 2.50) / 0.016);
			else if (2.58 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.65)
				score4 = 85 + int((m_lidingtiaoyuan - 2.58) / 0.014);
			else if (2.65 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.75)
				score4 = 90 + int((m_lidingtiaoyuan - 2.65) / 0.01);
			else
				score4 = 100;

			//50米跑单项成绩得分
			if (m_50m > 10.0)
				score5 = 0;
			else if (9.0 < m_50m && m_50m <= 10.0)
				score5 = 10 + int((m_50m - 10.0) / -0.02);
			else if (7.0 < m_50m && m_50m <= 9.0)
				score5 = 60 + int((m_50m - 9.0) / -0.1);
			else if (6.6 < m_50m && m_50m <= 7.0)
				score5 = 80 + int((m_50m - 7.0) / -0.02);
			else
				score5 = 100;

			//1000米跑单项成绩得分
			if ((m_1000m1 * 60 + m_1000m2) > (6 * 60 + 10))
				score6 = 0;
			else if ((4 * 60 + 30) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (6 * 60 + 10))
				score6 = 10 + int(((m_1000m1 * 60 + m_1000m2) - (6 * 60 + 10)) / -2);
			else if ((3 * 60 + 40) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (4 * 60 + 30))
				score6 = 60 + int(((m_1000m1 * 60 + m_1000m2) - (4 * 60 + 30)) / -2.5);
			else if ((3 * 60 + 32) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 40))
				score6 = 80 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 40)) / -1.6);
			else if ((3 * 60 + 25) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 32))
				score6 = 85 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 32)) / -1.4);
			else if ((3 * 60 + 15) <= (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 25))
				score6 = 90 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 25)) / -1);
			//男生1000米跑加分指标
			else if ((2 * 60 + 52) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < (3 * 60 + 15))
				score6 = 100 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) / -4);
			else if (90 < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < (2 * 60 + 52))
				if (-26 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) <= -23)
					score6 = 100 + 6;
				else if (-29 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) <= -26)
					score6 = 100 + 7;
				else if (-32 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) <= -29)
					score6 = 100 + 8;
				else if (-35 < ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) && ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) <= -32)
					score6 = 100 + 9;
				else// if ( ((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 15)) <= -35)
					score6 = 100 + 10;
			//		else
			//			MessageBox("似箭啊兄弟，你应该去参加国家队\n    （你跑的这么快谁信呀$_$）", "温馨提示)", MB_ICONINFORMATION);

					//引体向上单项成绩得分
			if (m_0 < 6)
				score7 = 0;
			else if (6 <= m_0 && m_0 < 11)
				score7 = 10 + (m_0 - 6) * 10;
			else if (11 <= m_0 && m_0 < 16)
				score7 = 60 + (m_0 - 11) * 4;
			else if (16 <= m_0 && m_0 < 20)
				score7 = 80 + (m_0 - 16) * 5;
			//男生引体向上分指标
			else if (20 <= m_0 && m_0 < 200)
				score7 = 100 + (m_0 - 20);
			//		else
			//			MessageBox("流批啊兄弟，这么强壮的身体军队里出来的吧\n         (一般人拉不了这么多引体向上)", "温馨提示(￢_￢)瞄", MB_ICONINFORMATION);
		}
		else
		{
			MessageBox("         非法操作\n你还是个小学生吧&_&\n    （请输入年级）", "系统已罢工￣へ￣", MB_ICONSTOP);
			return;
		}
	}

	else
	{
	GetDlgItemText(IDC_COMBO1, strText);
	if (strText == "①大一" || strText == "②大二")
	{
		//肺活量单项成绩得分
		if (m_feihuoliang < 1800)
			score2 = 0;
		else if (1800 <= m_feihuoliang && m_feihuoliang < 2000)
			score2 = 10 + int((m_feihuoliang - 1800) / 4);
		else if (2000 <= m_feihuoliang && m_feihuoliang < 3000)
			score2 = 60 + int((m_feihuoliang - 2000) / 50);
		else if (3000 <= m_feihuoliang && m_feihuoliang < 3300)
			score2 = 80 + int((m_feihuoliang - 3000) /30);
		else if (3300<= m_feihuoliang && m_feihuoliang < 3400)
			score2 = 90 + int((m_feihuoliang - 3300) / 10);
		else
			score2 = 100;

		//坐立前屈单项成绩得分
		if (m_zuoliqianqu < 2.0)
			score3 = 0;
		else if (2.0 <= m_zuoliqianqu && m_zuoliqianqu < 6.0)
			score3 = 10 + int((m_zuoliqianqu - 2) / 0.08);
		else if (6 <= m_zuoliqianqu && m_zuoliqianqu < 19)
			score3 = 60 + int((m_zuoliqianqu - 6) / 0.65);
		else if (19 <= m_zuoliqianqu && m_zuoliqianqu < 22.2)
			score3 = 80 + int((m_zuoliqianqu - 19) / 0.32);
		else if (22.2 <= m_zuoliqianqu && m_zuoliqianqu <25.8)
			score3 = 90 + int((m_zuoliqianqu - 22.2) / 0.36);
		else
			score3 = 100;

		//立定跳远单项成绩得分
		if (m_lidingtiaoyuan < 1.26)
			score4 = 0;
		else if (1.26 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 1.51)
			score4 = 10 + int((m_lidingtiaoyuan - 1.26) / 0.005);
		else if (1.51 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 1.81)
			score4 = 60 + int((m_lidingtiaoyuan - 1.51) / 0.015);
		else if (1.81 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 1.95)
			score4 = 80 + int((m_lidingtiaoyuan - 1.81) / 0.014);
		else if (1.95 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.07)
			score4 = 90 + int((m_lidingtiaoyuan - 1.95) / 0.012);
		else
			score4 = 100;

		//50米跑单项成绩得分
		if (m_50m > 11.3)
			score5 = 0;
		else if (10.3 < m_50m && m_50m <= 11.3)
			score5 = 10 + int((m_50m - 11.3) / -0.02);
		else if (8.3 < m_50m && m_50m <= 10.3)
			score5 = 60 + int((m_50m - 10.3) / -0.1);
		else if (7.7 < m_50m && m_50m <=8.3)
			score5 = 80 + int((m_50m - 8.3) / -0.06);
		else if (7.5< m_50m && m_50m <= 7.7)
			score5 = 90 + int((m_50m - 7.7) / -0.02);
		else
			score5 = 100;

		//800米跑单项成绩得分
		if ((m_1000m1 * 60 + m_1000m2) > (5 * 60 + 24))
			score6 = 0;
		else if ((4 * 60 + 34) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (5* 60 + 24))
			score6 = 10 + int(((m_1000m1 * 60 + m_1000m2) - (5 * 60 + 24)) / -1);
		else if ((3 * 60 + 44) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (4 * 60 + 34))
			score6 = 60 + int(((m_1000m1 * 60 + m_1000m2) - (4 * 60 + 34)) / -2.5);
		else if ((3 * 60 + 30) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 44))
			score6 = 80 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 44)) / -1.4);
		else if ((3 * 60 + 18) <= (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 30))
			score6 = 90 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 +30)) / -1.2);
		//女生800米跑加分指标
		else if (148 <= (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < (3 * 60 + 18))
			score6 = 100 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 18)) / -5);
		else if (90< (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < 148)
				score6 = 110;
		//		else
		//			MessageBox("似箭啊兄弟，你应该去参加国家队\n    （你跑的这么快谁信呀$_$）", "温馨提示(^_−)☆", MB_ICONINFORMATION);

		//仰卧起坐单项成绩得分
		if (m_0 <16)
			score7 = 0;
		else if (16<= m_0 && m_0 <26)
			score7 = 10 + (m_0 -16)*5;
		else if (26 <= m_0 && m_0 < 46)
			score7 = 60 + (m_0 -26);
		else if (46<= m_0 && m_0 <52)
			score7 = 80 + int((m_0 -46)/3*5*10)/10.0;
		else if (52 <= m_0 && m_0 < 56)
			score7 = 90 + (m_0 - 52) / 2 * 5;
		//加分指标
		else if (56 <= m_0 && m_0 <62)
			score7 = 100 + (m_0 - 56)/2;
		else if (62 <= m_0 && m_0 <69)
			score7 = 103 + (m_0 - 62);
		else if (69 <= m_0 && m_0 < 200)
			score7 = 110;
	}
	else if (strText == "③大三" || strText == "④大四")
	{
		//肺活量单项成绩得分
		if (m_feihuoliang <1850)
			score2 = 0;
		else if (1850<= m_feihuoliang && m_feihuoliang <2050)
			score2 = 10 + int((m_feihuoliang -1850) /4);
		else if (2050<= m_feihuoliang && m_feihuoliang <3050)
			score2 = 60 + int((m_feihuoliang -2050) /50);
		else if (3050<= m_feihuoliang && m_feihuoliang <3350)
			score2 = 80 + int((m_feihuoliang - 3050) /30);
		else if (3350<= m_feihuoliang && m_feihuoliang <3450)
			score2 = 90 + int((m_feihuoliang - 3350) /10);
		else
			score2 = 100;

		//坐立前屈单项成绩得分
		if (m_zuoliqianqu <2.5)
			score3 = 0;
		else if (2.5<= m_zuoliqianqu && m_zuoliqianqu <6.5)
			score3 = 10 + int((m_zuoliqianqu -2.5) /0.08);
		else if (6.5 <= m_zuoliqianqu && m_zuoliqianqu < 19.5)
			score3 = 60 + int((m_zuoliqianqu -6.5) / 0.65);
		else if (19.5 <= m_zuoliqianqu && m_zuoliqianqu <21)
			score3 = 80 + int((m_zuoliqianqu - 19.5) / 0.3);
		else if (21 <= m_zuoliqianqu && m_zuoliqianqu < 22.4)
			score3 = 85 + int((m_zuoliqianqu -21) / 0.28);
		else if (22.4 <= m_zuoliqianqu && m_zuoliqianqu < 24.4)
			score3 = 90 + int((m_zuoliqianqu -22.4) / 0.4);
		else if (24.4 <= m_zuoliqianqu && m_zuoliqianqu < 26.3)
			score3 = 95 + int((m_zuoliqianqu - 24.4) / 0.38);
		else
			score3 = 100;

		//立定跳远单项成绩得分
		if (m_lidingtiaoyuan < 1.27)
			score4 = 0;
		else if (1.27 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 1.52)
			score4 = 10 + int((m_lidingtiaoyuan - 1.27) / 0.005);
		else if (1.52 <= m_lidingtiaoyuan && m_lidingtiaoyuan <1.82)
			score4 = 60 + int((m_lidingtiaoyuan - 1.52) / 0.015);
		else if (1.82 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 1.96)
			score4 = 80 + int((m_lidingtiaoyuan -1.82) / 0.014);
		else if (1.96 <= m_lidingtiaoyuan && m_lidingtiaoyuan < 2.08)
			score4 = 90 + int((m_lidingtiaoyuan - 1.96) / 0.012);
		else
			score4 = 100;

		//50米跑单项成绩得分
		if (m_50m > 11.2)
			score5 = 0;
		else if (10.2 < m_50m && m_50m <= 11.2)
			score5 = 10 + int((m_50m - 11.2) / -0.02);
		else if (8.2 < m_50m && m_50m <= 10.2)
			score5 = 60 + int((m_50m - 10.2) / -0.1);
		else if (7.6 < m_50m && m_50m <= 8.2)
			score5 = 80 + int((m_50m - 8.2) / -0.06);
		else if (7.4 < m_50m && m_50m <= 7.6)
			score5 = 90 + int((m_50m - 7.6) / -0.02);
		else
			score5 = 100;

		//800米跑单项成绩得分
		if ((m_1000m1 * 60 + m_1000m2) > (5 * 60 + 22))
			score6 = 0;
		else if ((4 * 60 + 32) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (5 * 60 + 22))
			score6 = 10 + int(((m_1000m1 * 60 + m_1000m2) - (5 * 60 + 22)) / -1);
		else if ((3 * 60 + 42) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (4 * 60 + 32))
			score6 = 60 + int(((m_1000m1 * 60 + m_1000m2) - (4 * 60 + 32)) / -2.5);
		else if ((3 * 60 + 28) < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 42))
			score6 = 80 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 42)) / -1.4);
		else if ((3 * 60 + 16) <= (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= (3 * 60 + 28))
			score6 = 90 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 28)) / -1.2);
		//女生800米跑加分指标
		else if (146 <= (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < (3 * 60 + 16))
			score6 = 100 + int(((m_1000m1 * 60 + m_1000m2) - (3 * 60 + 16)) / -5);
		else if (90 < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) < 146)
			score6 = 110;

		//仰卧起坐单项成绩得分
		if (m_0 < 17)
			score7 = 0;
		else if (17 <= m_0 && m_0 < 27)
			score7 = 10 + (m_0 - 17) * 5;
		else if (27 <= m_0 && m_0 < 47)
			score7 = 60 + (m_0 - 27);
		else if (47 <= m_0 && m_0 < 53)
			score7 = 80 + int((m_0 - 47) / 3 * 5 * 10) / 10.0;
		else if (53 <= m_0 && m_0 < 57)
			score7 = 90 + (m_0 - 53) / 2 * 5;
		//加分指标
		else if (57 <= m_0 && m_0 < 63)
			score7 = 100 + (m_0 - 57) / 2;
		else if (63 <= m_0 && m_0 < 70)
			score7 = 103 + (m_0 - 63);
		else if (70 <= m_0 && m_0 < 200)
			score7 = 110;	
	}
	else
	{
		MessageBox("         请输入年级", "温馨提示", MB_ICONSTOP);
		return;
	}
 }

//存在的BUG?????????????由于变量m_zuotiqianqu默认赋值以及初始化均为0，该成绩指标包含0字段，因此不能判断0字段是否为初始化成绩或者输入成绩
	if (m_shengao == 0 || m_tizhong == 0 || m_feihuoliang == 0 || m_zuoliqianqu == -30 || m_lidingtiaoyuan == 0 || m_50m == 0 || (m_1000m1 == 0 && m_1000m2 == 0) || m_0 == 0)
	  {
		  MessageBox("信息录入不完整，请检查后重试", "温馨提示", MB_ICONINFORMATION | MB_RETRYCANCEL);
		  return;
	}
	score = (score1 * 0.15 + score2 * 0.15 + score3 * 0.1 + score4 * 0.1 + score5 * 0.2 + score6 * 0.2 + score7 * 0.1);
	if (score1 == 0 || score2 == 0 || score3 == 0 || score4 == 0 || score5 == 0 || score6 == 0 || score7 == 0)
	{
		MessageBox("您的单项成绩中存在低于10分(不含10分)的成绩\n             该项成绩将按0分计算，是否继续？", "*警告*", MB_YESNO| MB_ICONEXCLAMATION);
	}

	if (score2 < 60)
		n2 = "不及格  ";
	else if (60 <= score2 && score2 < 80)
		n2 = "及格     ";
	else if (80 <= score2 && score2 < 90)
		n2 = "良好     ";
	else
		n2 = "优秀     ";

	if (score3 < 60)
		n3 = "不及格  ";
	else if (60 <= score3 && score3 < 80)
		n3 = "及格     ";
	else if (80 <= score3 && score3 < 90)
		n3 = "良好     ";
	else
		n3 = "优秀     ";

	if (score4 < 60)
		n4 = "不及格  ";
	else if (60 <= score4 && score4 < 80)
		n4 = "及格     ";
	else if (80 <= score4 && score4 < 90)
		n4 = "良好     ";
	else
		n4 = "优秀     ";

	if (score5 < 60)
		n5 = "不及格  ";
	else if (60 <= score5 && score5 < 80)
		n5 = "及格     ";
	else if (80 <= score5 && score5 < 90)
		n5 = "良好     ";
	else
		n5 = "优秀     ";

	if (score6 < 60)
		n6 = "不及格  ";
	else if (60 <= score6 && score6 < 80)
		n6 = "及格     ";
	else if (80 <= score6 && score6 < 90)
		n6 = "良好     ";
	else
		n6 = "优秀     ";

	if (score7 < 60)
		n7 = "不及格  ";
	else if (60 <= score7 && score7 < 80)
		n7 = "及格     ";
	else if (80 <= score7 && score7 < 90)
		n7 = "良好     ";
	else
		n7 = "优秀     ";

	str1.Format("%s%s%.2lf%s", "单项测试项目指标                     等级     成绩\r\n体重指数(BMI)                         ", n1, score1,"\r\n");
	str2.Format("%s%s%.2lf%s", "肺活量                                    ",n2,score2,"\r\n");
	str3.Format("%s%s%.2lf%s","坐位体前屈                              ",n3,score3,"\r\n");
	str4.Format("%s%s%.2lf%s","立定跳远                                 ",n4,score4,"\r\n");
	str5.Format("%s%s%.2lf%s", "50米跑                                    ", n5, score5, "\r\n");
	str6.Format("%s%s%.2lf%s", "1000米跑(男)/800米跑(女)          ", n6, score6, "\r\n");
	str7.Format("%s%s%.2lf%s%s%s%.2lf%s", "引体向上(男)/1分钟仰卧起坐(女)  ", n7, score7, "\r\n",str8,"您的体测最终成绩为：                         ",score,"\r\n");
	str8.Format("%s", str8);
	str.Format("%s%s%s%s%s",str9, str10, str11, str12, str13);//这里是你要显示的内容
	str = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8 + str;
	SetDlgItemText(IDC_EDIT10, str);
}

//清空按钮响应程序
void CTest1Dlg::OnBnClickedButton2()
{
	// TODO: 在此添加控件通知处理程序代码
	CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT1);//获取身高的编辑框ID
	pEdit1->SetWindowText(_T("如:170")); //设置默认显示的内容 

	CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT2);//获取体重的编辑框ID
	pEdit2->SetWindowText(_T("如:50")); //设置默认显示的内容 

	CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT3);//获取肺活量的编辑框ID
	pEdit3->SetWindowText(_T("如:3000")); //设置默认显示的内容 

	CEdit* pEdit4 = (CEdit*)GetDlgItem(IDC_EDIT4);//获取坐立前屈的编辑框ID
	pEdit4->SetWindowText(_T("如:15")); //设置默认显示的内容 

	CEdit* pEdit5 = (CEdit*)GetDlgItem(IDC_EDIT5);//获取立定跳远的编辑框ID
	pEdit5->SetWindowText(_T("如:2.2")); //设置默认显示的内容 

	CEdit* pEdit6 = (CEdit*)GetDlgItem(IDC_EDIT6);//获取50米跑的编辑框ID
	pEdit6->SetWindowText(_T("如:7.5")); //设置默认显示的内容

	CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
	pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

	CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
	pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 

	CEdit* pEdit9 = (CEdit*)GetDlgItem(IDC_EDIT9);//获取引体向上的编辑框ID
	pEdit9->SetWindowText(_T("如:15")); //设置默认显示的内容 

	CString str = "";
	str.Format("%s", str);
	SetDlgItemText(IDC_EDIT10, str);

	((CComboBox*)GetDlgItem(IDC_COMBO1))->ResetContent();
//	m_setCombobox.SetCurSel(4);
	m_setCombobox.AddString("①大一");//添加ComboBox数据
	m_setCombobox.AddString("②大二");
	m_setCombobox.AddString("③大三");
	m_setCombobox.AddString("④大四");
}


void CTest1Dlg::OnKillfocusEdit1()
{
	// TODO: 在此添加控件通知处理程序代码
    CString strText;
	GetDlgItemText(IDC_EDIT1, strText);
	m_shengao = atof(strText);
	if (m_shengao == 0)
	{
		MessageBox("请输入正确的身高", "温馨提示", MB_ICONEXCLAMATION);
		CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT1);
		pEdit1->SetWindowText(_T("如:170")); 
		return;
	}
	else if (1 <= m_shengao && m_shengao <= 20)
	{
		MessageBox("      咋回事啊小老弟@_@\n   刚出生的小弟弟都比你长\n(你长这么矮我咋不信呢=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT1);
		pEdit1->SetWindowText(_T("如:170"));
		return;
	}
	else if (m_shengao >= 350)
	{
		MessageBox("       君比天高%_%\n(你长这么高我咋不信呢=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT1);
		pEdit1->SetWindowText(_T("如:170"));
		return;
	}
//	UpdateData(FALSE);
}

void CTest1Dlg::OnKillfocusEdit2()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT2, strText);
	m_tizhong = atof(strText);
	if (m_tizhong == 0)
	{
		MessageBox("请输入正确的体重", "温馨提示", MB_ICONEXCLAMATION);
		CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT2);//获取体重的编辑框ID
		pEdit2->SetWindowText(_T("如:50")); //设置默认显示的内容 
		return;
	}
	else if (1 <= m_tizhong && m_tizhong <= 20)
	{
		MessageBox("      轻如鸿毛\n(你怎么这么瘦呢=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT2);//获取体重的编辑框ID
		pEdit2->SetWindowText(_T("如:50")); //设置默认显示的内容 
		return;
	}
	else if (m_tizhong >= 300)
	{
		MessageBox("       重于泰山\n(不会这么胖吧=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT2);//获取体重的编辑框ID
		pEdit2->SetWindowText(_T("如:50")); //设置默认显示的内容 
		return;
	}
	double BMI = (int(m_tizhong/((m_shengao/100)*(m_shengao/100)) * 10)) / 10.0;
	if (sex == 1)
	{
		if (BMI >= 28.0)
		{
			score1 = 60;
			n1 = "肥胖     ";
		}
		else if (BMI <= 17.8)
		{
			score1 = 80;
			n1 = "低体重  ";
		}
		else if (24.0 <= BMI && BMI <= 27.9)
		{
			score1 = 80;
			n1 = "超重     ";
		}
		else if (17.9 <= BMI && BMI <= 23.9)
		{
			score1 = 100;
			n1 = "正常     ";
		}
	}
	else if (sex == 2)
	{
		if (BMI >= 28.0)
		{
			score1 = 60;
			n1 = "肥胖     ";
		}
		else if (BMI <= 17.1)
		{
			score1 = 80;
			n1 = "低体重  ";
		}
		else if (24.0 <= BMI && BMI <= 27.9)
		{
			score1 = 80;
			n1 = "超重     ";
		}
		else if (17.2 <= BMI && BMI <= 23.9)
		{
			score1 = 100;
			n1 = "正常     ";
		}
	}
}


void CTest1Dlg::OnKillfocusEdit3()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT3, strText);
	m_feihuoliang = atof(strText);
	if (m_feihuoliang == 0)
	{
		MessageBox("请输入正确的肺活量", "系统罢工了o(*≧д≦)o!!", MB_ICONEXCLAMATION);
		CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT3);//获取肺活量的编辑框ID
		pEdit3->SetWindowText(_T("如:3000")); //设置默认显示的内容
		return;
	}
	else if (1 <= m_feihuoliang && m_feihuoliang <= 500)
	{
		MessageBox("      你有男/女盆友吗@_@\n 据说接吻可以练习肺活量哦\n(你肺活量太小了=_=）", "温馨提示", MB_ICONQUESTION);
		CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT3);//获取肺活量的编辑框ID
		pEdit3->SetWindowText(_T("如:3000")); //设置默认显示的内容 
		return;
	}
	else if (m_feihuoliang >= 15000)
	{
		MessageBox("       憋气好能手\n(牛皮都能让你吹爆=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT3);//获取肺活量的编辑框ID
		pEdit3->SetWindowText(_T("如:3000")); //设置默认显示的内容 
		return;
	}
//	UpdateData(FALSE);
}


void CTest1Dlg::OnKillfocusEdit4()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT4, strText);
	m_zuoliqianqu = atof(strText);
	if (m_zuoliqianqu < -30)
	{
		MessageBox("别逗我，坐在地上你膝盖都碰不到？", "温馨提示", MB_ICONEXCLAMATION);
		CEdit* pEdit4 = (CEdit*)GetDlgItem(IDC_EDIT4);//获取坐立前屈的编辑框ID
		pEdit4->SetWindowText(_T("如:15")); //设置默认显示的内容 
		return;
	}
	else if (100 <= m_zuoliqianqu)
	{
		MessageBox("       你肯定是水做的%_%\n(身体辣么软=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit4 = (CEdit*)GetDlgItem(IDC_EDIT4);//获取坐立前屈的编辑框ID
		pEdit4->SetWindowText(_T("如:15")); //设置默认显示的内容 
		return;
	}
}


void CTest1Dlg::OnKillfocusEdit5()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT5, strText);
	m_lidingtiaoyuan = atof(strText);
	if (m_lidingtiaoyuan == 0)
	{
		MessageBox("请输入正确的立定跳远距离", "系统罢工了o(*≧д≦)o!!", MB_ICONEXCLAMATION);
		CEdit* pEdit5 = (CEdit*)GetDlgItem(IDC_EDIT5);
		pEdit5->SetWindowText(_T("如:2.2")); //设置默认显示的内容 
		return;
	}
	else if (0< m_lidingtiaoyuan && m_lidingtiaoyuan <= 0.9)
	{
		MessageBox("      我迈一步都比你跳的远@_@\n 抓紧练习怎么跳远啊\n(你跳的太小近=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit5 = (CEdit*)GetDlgItem(IDC_EDIT5);
		pEdit5->SetWindowText(_T("如:2.2")); //设置默认显示的内容
		return;
	}
	else if (m_lidingtiaoyuan >= 6)
	{
		MessageBox("       你咋不上天呢%_%\n(跳这么远肯定有双好腿=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit5 = (CEdit*)GetDlgItem(IDC_EDIT5);
		pEdit5->SetWindowText(_T("如:2.2")); //设置默认显示的内容 
		return;
	}
}


void CTest1Dlg::OnKillfocusEdit6()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT6, strText);
	m_50m = atof(strText);
	if (m_50m == 0)
	{
		MessageBox("请输入正确的50米跑耗时", "系统罢工了o(*≧д≦)o!!", MB_ICONEXCLAMATION);
		CEdit* pEdit6 = (CEdit*)GetDlgItem(IDC_EDIT6);//获取50米跑的编辑框ID
		pEdit6->SetWindowText(_T("如:7.5")); //设置默认显示的内容
		return;
	}
	else if (0 < m_50m && m_50m <= 3)
	{
		MessageBox("       开车开这么快你有驾驶证吗%_%\n(跑这么快肯定有双好腿=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit6 = (CEdit*)GetDlgItem(IDC_EDIT6);//获取50米跑的编辑框ID
		pEdit6->SetWindowText(_T("如:7.5")); //设置默认显示的内容
		return;
	}
	else if (m_50m >= 100)
	{
		MessageBox("       我走路都比你快\n(走这么慢肯定又偷看小姐姐了=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit6 = (CEdit*)GetDlgItem(IDC_EDIT6);//获取50米跑的编辑框ID
		pEdit6->SetWindowText(_T("如:7.5")); //设置默认显示的内容
		return;
	}

}


void CTest1Dlg::OnKillfocusEdit7()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT7, strText);
	m_1000m1 = atof(strText);
	GetDlgItemText(IDC_EDIT8, strText);
	m_1000m2 = atof(strText);
	if ((m_1000m1*60+ m_1000m2) == 0)
	{
		MessageBox("请输入正确的1000米跑耗时", "系统罢工了o(*≧д≦)o!!", MB_ICONEXCLAMATION);
		CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
		pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

		CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
		pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 
		return;
	}
	else if (0 < (m_1000m1*60+m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= 90)
	{
		MessageBox("       开车开这么快你有驾驶证吗%_%\n(1分半跑完1000米的人才=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
		pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

		CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
		pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 
		return;
	}
	else if ((m_1000m1 * 60 + m_1000m2) >= 600)
	{
		MessageBox("       我走路都比你快\n(走这么慢肯定又偷看小姐姐了=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
		pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

		CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
		pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 
		return;
	}

}


void CTest1Dlg::OnKillfocusEdit8()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT7, strText);
	m_1000m1 = atof(strText);
	GetDlgItemText(IDC_EDIT8, strText);
	m_1000m2 = atof(strText);
	if ((m_1000m1 * 60 + m_1000m2) == 0)
	{
		MessageBox("请输入正确的1000米跑耗时", "系统罢工了o(*≧д≦)o!!", MB_ICONEXCLAMATION);
		CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
		pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

		CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
		pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 
		return;
	}
	else if (0 < (m_1000m1 * 60 + m_1000m2) && (m_1000m1 * 60 + m_1000m2) <= 90)
	{
		MessageBox("       开车开这么快你有驾驶证吗%_%\n(1分半跑完1000米的人才=_=）", "被你玩坏了o(≧口≦)o", MB_ICONQUESTION);
		CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
		pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

		CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
		pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 
		return;
	}
	else if ((m_1000m1 * 60 + m_1000m2) >= 600)
	{
		MessageBox("       我走路都比你快\n(走这么慢肯定又偷懒了=_=）", "又被玩坏了(*`д´*) ", MB_ICONQUESTION);
		CEdit* pEdit7 = (CEdit*)GetDlgItem(IDC_EDIT7);//获取1000米跑分钟的编辑框ID
		pEdit7->SetWindowText(_T("如:3")); //设置默认显示的内容 

		CEdit* pEdit8 = (CEdit*)GetDlgItem(IDC_EDIT8);//获取1000米跑秒的编辑框ID
		pEdit8->SetWindowText(_T("如:10")); //设置默认显示的内容 
		return;
	}
}


void CTest1Dlg::OnKillfocusEdit9()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strText;
	GetDlgItemText(IDC_EDIT9, strText);
	m_0 = atof(strText);
	if (m_0 == 0)
	{
		MessageBox("不会吧，一个也做不了？", "系统罢工了o(*≧д≦)o!!", MB_ICONEXCLAMATION);
		CEdit* pEdit9 = (CEdit*)GetDlgItem(IDC_EDIT9);//获取引体向上的编辑框ID
		pEdit9->SetWindowText(_T("如:15")); //设置默认显示的内容
		return;
	}
	else if (m_0 >= 200)
	{
		MessageBox("流批啊，这么强壮的身体军队里出来的吧\n         (看来在军队里没少挨罚)", "温馨提示(￢_￢)瞄", MB_ICONINFORMATION);
		CEdit* pEdit9 = (CEdit*)GetDlgItem(IDC_EDIT9);//获取引体向上的编辑框ID
		pEdit9->SetWindowText(_T("如:15")); //设置默认显示的内容
		return;
	}
}


void CTest1Dlg::OnBnClickedButton3()
{
	// TODO: 在此添加控件通知处理程序代码
	str1 = "单项测试项目指标                     权重\r\n体重指数(BMI)                          15%\r\n",
    str2 = "肺活量                                     15%\r\n坐位体前屈                               10%\r\n",
	str3 = "立定跳远                                  10%\r\n50米跑                                     20%\r\n",
	str4 = "1000米跑(男)/800米跑(女)           20%\r\n引体向上(男)/1分钟仰卧起坐(女)  10%\r\n",
    str.Format("%s%s%s%s%s%s%s%s%s%s",str1,str2,str3,str4,str8,str9,str10,str11,str12,str13);//这里是你要显示的内容
	SetDlgItemText(IDC_EDIT10, str);
}

// 单选框:性别男
// 当性别为男时将"800米跑"和"仰卧起坐"项目分别替换为"1000米跑"和"引体向上"
void CTest1Dlg::OnRadio1()
{
	// TODO: 在此添加命令处理程序代码
	sex = 1;
	CEdit* pEdit11 = (CEdit*)GetDlgItem(1018);
	pEdit11->SetWindowText(_T("1000米跑"));

	CEdit* pEdit12 = (CEdit*)GetDlgItem(1019);
	pEdit12->SetWindowText(_T("引体向上"));
}

// 单选框:性别女
// 当性别为女时将"1000米跑"和"引体向上"项目分别替换为"800米跑"和"仰卧起坐"
void CTest1Dlg::OnRadio2()
{
	// TODO: 在此添加命令处理程序代码
	sex = 2;
	CEdit* pEdit11 = (CEdit*)GetDlgItem(1018);
	pEdit11->SetWindowText(_T(" 800米跑"));

	CEdit* pEdit12 = (CEdit*)GetDlgItem(1019);
	pEdit12->SetWindowText(_T("仰卧起坐"));
}
